package com.itheima.day08;

import java.util.ArrayList;
import java.util.LinkedList;

/*
测试 ArrayList 和 LinkedList 在数据达到1000w 以后的性能
 */
public class Test02_02 {


    public static void main(String[] args) {
        LinkedList<Integer> list = new LinkedList<Integer>();

        for (int i = 0; i < 10000000; i++) {

            list.add(i);
        }

        //增
        long start = System.currentTimeMillis();
        //头插 100 w 355
        for (int i = 0; i < 1000000; i++) {
           list.addFirst(i);
        }
      //尾插  10w   6
     /*   for (int i = 0; i < 100000; i++) {
            list.add(i);
        }*/
     //中间插入  100 5169
      /*  for (int i = 0; i < 100; i++) {
            list.add(5000000,i);
        }*/
        long end = System.currentTimeMillis();

        System.out.println(end-start);
    }

}
